<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="./Js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="./Js/index.js"></script>
<link rel="stylesheet" href="./Css/public.css" />
<link rel="stylesheet" href="./Css/index.css" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<base target="iframe"/>
<head>

</head>
<body>
	<div id="top">
		<div class="menu">
			<a href="#">选择按钮</a>
			<a href="#">选择按钮</a>
			<a href="#">选择按钮</a>
			<a href="#">选择按钮</a>
			<a href="#">选择按钮</a>
		</div>
		<div class="exit">
			<a href="#" target="_self">退出</a>
			<a href="http://bbs.houdunwang.com" target="_blank">获得帮助</a>
			<a href="http://www.houdunwang.com" target="_blank">后盾网</a>
		</div>
	</div>
	<div id="left">
		<dl>
			<dt>功能标题</dt>
			<dd><a href="#">功能标题</a></dd>
			<dd><a href="#">功能标题</a></dd>
			<dd><a href="#">功能标题</a></dd>
			<dd><a href="#">功能标题</a></dd>
			<dd><a href="#">功能标题</a></dd>
			<dd><a href="#">功能标题</a></dd>
		</dl>
	
	
	</div>
    <div>
        <body>
       <?php 
  include_once "../config.php";
?>            
    <?php 
    
    $sql_cnt = "SELECT id FROM wish";
    $result =$conn->query($sql_cnt);
    $total_cnt = $result->num_rows;
    $listRows = 5;
    $total_pages = ceil($total_cnt/$listRows);
    
    $page = empty($_GET['p']) ? 1 : $GET['p'];
    $page = ($page < 1) ? 1 : $page;
    $page = ($page > $total_pages) ? $total_pages : $page;
                   

  $sql="select * from wish  limit  ". ($page - 1)*5 ." ,5";
  
  
   $result=$conn->query($sql);
   
   $arrlist=array();
   
   if($result->num_rows> 0){
       while($row=$result->fetch_assoc()){
           array_push($arrlist,$row);
       };
    }
   else{
   echo"0 results";
   }
  $conn->close(); ?>
    <div id="right">

        <table border="1">
            <tr>
                <td>序号</td>
                <td>留言者</td>
                <td>留言内容</td>
                <td>留言时间</td>
                <td>操作</td>
            </tr>
            <?php  foreach($arrlist as $vo) { ?>
              <tr>
                  <td><?php echo $vo['id']; ?></td>
                <td><?php echo $vo['username']; ?></td>
                <td><?php echo $vo['content']; ?></td>
                <td><?php echo $vo['time_at']; ?></td>
                <td><span><a>修改</a></span>　　<span><a href='delet.php?id=<?php echo $vo['id'];?>'>删除</a></span></td>
            </tr>
            <?php } ?>
        </table>
        
        <div id ="page">
            <?php 
            $s = "";
                    for($i=1; $i<=$total_pages ; $i++){
                        $s.="<span><a href='? p = $i'>$i</a></span>";
                    }
                    echo $s;
                 ?>
        </div>
       
	</div>
</body>
</html>